﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
using abp.Users;
using Volo.Abp.Domain.Entities.Auditing;

namespace abp.Roles
{
    /// <summary>
    /// 角色
    /// </summary>
    public class LoginRole :AuditedAggregateRoot<int>
    {
        /// <summary>
        /// 角色名
        /// </summary>
        [Required]
        [MaxLength(25)]
        public string RoleName { get; set; }

        /// <summary>
        /// 显示名
        /// </summary>
        [MaxLength(50)]
        public string DisplayName
        {
            get
            {
                if (string.IsNullOrEmpty(DisplayName)) return RoleName;
                return DisplayName;
            }
        }

        private List<LoginUser> users;


        /// <summary>
        /// 用户
        /// </summary>
        public IReadOnlyList<LoginUser> Users => users.AsReadOnly();

    }
}
